var settings = settings ||{};
var pageForm = new PageForm(settings||{});
function validate_form(thisform)
{
  return true;
}
function render(){
	var oper = $("#showErrMsg").attr("oper");
	if(oper=="0"){
		$("#showErrMsg").addClass("hide");
	}else{
		var val = $("#showErrMsg").attr("val");
		if(val=="200"){
			$("#showErrMsg").removeClass("hide");
			$("#formDiv").hide();
			$("#success").show().html($("#showErrMsg").find("div").html()).prev(".widget-body").hide();
		}else{
			if(val=="905"){
				$("#backPasswordForm").remove();
			}
			$("#showErrMsg").removeClass("hide");
		}
	}
}
pageForm.formCheck = function(form,e){//
	if(!form.validationEngine("validate")){
		  return false;
	} 
	return true;
};
pageForm.formBeforeSubmit = function(form,e){//
   $("#next").attr("disabled",true);
   $("#next").attr("normal-title",$("#next span").html());
   var t = $("#next").attr("dealing-title");
   if(t){
	   $("#next span").html(t+"...");
   }else{
	   $("#next span").html($("#next span").html()+"...");
   }
};
pageForm.formSuccess = function(form,data){//
	$("#showErrMsg").attr("oper",data.oper);
	if(data.status!=200){
		$("#showErrMsg").attr("oper","");
	}
     $("#showErrMsg").attr("val",data.status);
     $("#showErrMsg").find("div").html(data.desc);
     render();
     $("#randCodeImage").click(); 
};
pageForm.formComplete = function(form,XMLHttpRequest, textStatus){//
	 $("#next span").html($("#next").attr("normal-title"));
	 $("#next").attr("disabled",false);
};
pageForm.formError = function(form,xhr, status, error){//
	$("#showErrMsg").attr("oper",data.oper);
	if(data.status!=200){
		$("#showErrMsg").attr("oper","");
	}
     $("#showErrMsg").attr("val",data.status);
     $("#showErrMsg").find("div").html(data.desc);
     render();
     $("#randCodeImage").click();  
};
$(function() {
	pageForm.init({formId:"backPasswordForm"})
	 $(document).find("input").each(function(){
		 $(this).attr("autocomplete","off");
	 });
	 render();
	$("#backPasswordForm .inputElem").mailAutoComplete();
    $("#backPasswordForm").validationEngine('attach', {promptPosition : "topRight", autoPositionUpdate : true});
});
